﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Wpf_Tool_ZC
{
    /// <summary>
    /// Wnd_Log.xaml 的交互逻辑
    /// </summary>
    public partial class Wnd_Log : Window
    {
        public Wnd_Log()
        {
            InitializeComponent();
        }

        private void Wnd_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            MainWindow.Self.FwndLog = null;
        }

        private void Click_ClearMsg(object sender, RoutedEventArgs e)
        {
            tbMsg.Clear();
        }

        /// <summary>
        /// 添加信息 (后面带时间)   // ZC: 没法像C++那样"const string& _str"传参么？ 像下面这样传参 能确保是引用传值么？？
        /// </summary>
        public void MsgAppend(string _str)
        {
            // string str = DateTime.Now.ToString(@"yyyyMMdd_HHmmss_fff");
            tbMsg.AppendText(_str + " (" + DateTime.Now.ToString("HH:mm:ss.fff") + ")" + "\r\n");
        }

        /// <summary>
        /// 添加信息 (后面不带时间，只自动加上"\r\n")
        /// </summary>
        /// <param name="_str"></param>
        public void MsgAppend_01(string _str)
        {
            tbMsg.AppendText(_str + "\r\n");
        }

    }
}
